package com.wpre.lotterysystem.common.filter;

import ch.qos.logback.classic.Level;
import ch.qos.logback.classic.spi.ILoggingEvent;
import ch.qos.logback.core.filter.Filter;
import ch.qos.logback.core.spi.FilterReply;

/**
 * Created with IntelliJ IDEA.
 * Description: 自定义过滤器,这个过滤器可以被集成到日志框架中,如Log4j,用于控制日志输出,只输出INFO级别的日志,忽略其他级别的日志
 * User: LianBao
 * Date: 2024-12-11
 * Time: 14:47
 */
public class InfoLevelFilter extends Filter<ILoggingEvent> {
    @Override
    public FilterReply decide(ILoggingEvent iLoggingEvent) {
        if (iLoggingEvent.getLevel().toInt() == Level.INFO.toInt()) {
            return FilterReply.ACCEPT;
        }
        return FilterReply.DENY;
    }
}
